<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
    }

    .searchbox {
        margin: 5px auto;
        width: 500px;
        height: 25px;

    }

    input {
        border-radius: 10px;
        height: 25px;
        background: #f5f5f5;
    }

    .searchbox span {
        display: inline-block;
        font-size: 20px;
        color: deepskyblue;
        margin-left: 5px;
        margin-top: 10px;
        cursor: pointer;
    }

    .block {
        width: 500px;
        margin: 50px auto;

    }

    .title {
        margin-bottom: 10px;
        font-weight: 700;
    }

    .list span {
        display: inline-block;
        height: 25px;
        background: #f5f5f5;
        border: 1px solid black;
        border-radius: 5px;
        margin-right: 5px;

    }
</style>

<body>
    <!--  //v-model 配合input框使用 -->
    <div id="app">
        <div class="searchbox">
            <input type="text" placeholder="请输入食品" v-model="searchText">
            <span @click="add">{{search}}</span>
        </div>
        <div class="block">
            <div class="title">{{historySearch}}</div>
            <div class="list">
                <span v-for="(item,index) in searchArr">{{item}}</span>
            </div>
        </div>
    </div>
    <script src="vue.js"></script>
    <script src="demo1.js"></script>
</body>

</html>